package com.xtx.air.web.action;


import com.opensymphony.xwork2.ActionSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.apache.struts2.interceptor.SessionAware;

import java.util.Map;

public class BaseAction extends ActionSupport implements SessionAware {
    private static final long serialVersionUID = 7832295150101890553L;
    protected Log logger = LogFactory.getLog(this.getClass());
    protected Map session;
    private String operName;


    public void setSession(Map session) {
        this.session = session;
    }

    public String getOperName() {
        Subject subject = SecurityUtils.getSubject();
        if(subject.isAuthenticated()){
            operName = subject.getPrincipal().toString();
        }else {
            operName = "游客";
        }
        return operName;
    }
}